<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@page session="true"%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="./util/configurationPage.jsp"/>
</head>
<body>
    <jsp:include page="./util/navbar/navbarMain.jsp"/>
    <br>
	<h1>Panel administratora</h1>

	<c:url value="/logout" var="logoutUrl" />
	<form action="${logoutUrl}" method="post" id="logoutForm">
		<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
	</form>
	<script>
		function formSubmit() {
			document.getElementById("logoutForm").submit();
		}
	</script>
	<%=request.getContextPath()%>
	<br>
    <%= request.getRequestURI() %>
	<br>
    <%= request.getRequestURL() %>
	<br>
	<c:out value="${loginUrl}"/>
	<br>
	${pageContext.session.getAttribute('com.skb.model.UserRoles')}
	<br>
     <c:out value="${pageContext.request.scheme}://${pageContext.request.serverName}"/>

<c:set var="str" value="${pageContext.session.getAttribute('com.skb.model.UserRoles')}"/>
<c:if test="${fn:contains(str, 'ROLE_ADMIN')}">
   <p>Found test string<p>
</c:if>
	<c:if test="${pageContext.request.userPrincipal.name != null}">
		<h2>
			Witaj : ${pageContext.request.userPrincipal.name} | <a href="javascript:formSubmit()">Wyloguj</a>
			<br>
			Akcje : <a href="addUser">Dodaj użytkownika</a> |
            <a target="_blank" href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}/orbeon/fr/">Zarządzaj formularzami</a>
		</h2>
	</c:if>
    <jsp:include page="./util/footer.jsp"/>
</body>
</html>